package com.lcm.springcloud.service.impl;

import com.lcm.springcloud.mapper.PaymentMapper;
import com.lcm.springcloud.model.converter.PaymentConverter;
import com.lcm.springcloud.param.PaymentParam;
import com.lcm.springcloud.model.entity.Payment;
import com.lcm.springcloud.service.PaymentService;
import com.lcm.springcloud.vo.PaymentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: Coder-Lcm
 * @date: 2020/10/26 16:53
 */
@Service
public class PaymentServiceImpl implements PaymentService {

    @Autowired
    PaymentMapper paymentMapper;

    @Override
    public boolean addPayment(PaymentParam payment) {
        Payment save = PaymentConverter.INSTANCE.toPayment(payment);
        return paymentMapper.save(save);
    }

    @Override
    public PaymentVO findById(Long id) {
        Payment result = paymentMapper.getById(id);
        return PaymentConverter.INSTANCE.toPaymentVO(result);
    }
}
